﻿
(function ($) {
    
    app.modals.CreateOrEditStopEquipmentModal = function () {

        var _modalManager;

        var _stopEquipmentService = abp.services.app.stopEquipment;


        var _$stopEquipmentInformationForm = null;
       

        this.init = function (modalManager) {
            _modalManager = modalManager;
            _$stopEquipmentInformationForm = _modalManager.getModal().find("form[name=stopEquipmentInformationsForm]");
            //包含时分秒的日期选择器
            $("#time1").datetimepicker({
                format: 'yyyy-mm-dd hh:ii',
                autoclose: true,
                todayBtn: true,
            });
            $("#StopDate").datetimepicker({
                format: 'yyyy-mm-dd hh:ii',
                autoclose: true,
                todayBtn: true,
            });
        }

        this.save = function () {

            //校验通过

            var stopEquipment = _$stopEquipmentInformationForm.serializeFormToObject();
            //  console.log(aNDON);

            _modalManager.setBusy(true);

            _stopEquipmentService.createOrUpdateStopEquipmentAsync({
                stopEquipmentEditDto: stopEquipment
            }).done(function () {
                //提示信息
                abp.notify.info(app.localize('SavedSuccessfully'));
                abp.event.trigger('app.createOrEditStopEquipmentModalSaved');
                //关闭窗体
                _modalManager.close();
                //信息保存成功后调用事件，刷新列表
               

            }).always(function () {
                _modalManager.setBusy(false);
            });
        }

    }
})(jQuery);




   